﻿namespace ModuleOne
{
    using System;
    using System.ComponentModel.Composition;
    using System.Windows;

    using MEF_Test.Bricks.StronglyTypedExports;

    /// <summary>
    /// Holds some exports to configure the <see cref="LocalFolderMediaHandlerFactory"/>.
    /// </summary>
    public class LocalFolderMediaHandlerSettings
    {
        // TODO : Rename properties, backingfields, and resource keys according to their templateKind

        /// <summary>
        /// The default datatemplate for the detail panel of a local folder in a disk-based view.
        /// </summary>
        private static readonly DataTemplate _localFolderMediaHandlerDetailDataTemplate;

        /// <summary>        
        /// The default datatemplate for the browsernode of a local folder in a disk-based view.
        /// </summary>
        private static readonly DataTemplate _localFolderMediaHandlerDataTemplate;

        static readonly private DataTemplate _browserItemDiskDataTemplate;

        /// <summary>
        /// Initializes static members of the <see cref="LocalFolderMediaHandlerSettings"/> class. 
        /// </summary>
        static LocalFolderMediaHandlerSettings()
        {
            var source = new Uri("/ModuleOne;component/Resources/BrowserElementTemplate.xaml", UriKind.Relative);
            var resourceDictionary = new ResourceDictionary { Source = source };
            _localFolderMediaHandlerDetailDataTemplate = (DataTemplate)resourceDictionary["LocalFolderDetailTemplate"];
            _localFolderMediaHandlerDataTemplate = (DataTemplate)resourceDictionary["LocalFolderTemplate"];
            _browserItemDiskDataTemplate = (DataTemplate)resourceDictionary["BrowserItemDiskDataTemplate"];
        }

        /// <summary>
        /// Gets the local folder media handler data template.
        /// </summary>
        /// <value>The local folder media handler data template.</value>
        [Export]
        [MediaHandlerTemplateExport(TemplateGuid = "D08BFF9F-E849-4FA2-AED6-4AC22525AE1D", IsDefaultTemplate = true, DefaultTemplateKind = "BrowserItem.Disk.Media.Detail.folder/local")]
        public DataTemplate LocalFolderMediaHandlerDetailDataTemplate
        {
            get
            {
                return _localFolderMediaHandlerDetailDataTemplate;
            }           
        }

        /// <summary>
        /// Gets the local folder media handler data template.
        /// </summary>
        /// <value>The local folder media handler data template.</value>
        [Export]
        [MediaHandlerTemplateExport(TemplateGuid = "12345678-9012-3456-7890-123456789012", IsDefaultTemplate = true, DefaultTemplateKind = "BrowserItem.Disk.Media.folder/local")]
        public DataTemplate LocalFolderMediaHandlerDataTemplate
        {
            get
            {
                return _localFolderMediaHandlerDataTemplate;
            }
        }

        /// <summary>
        /// Gets the browser item disk data template.
        /// </summary>
        /// <value>The browser item disk data template.</value>
        [Export]
        [MediaHandlerTemplateExport(TemplateGuid = "22345678-9012-3456-7890-123456789012", IsDefaultTemplate = true, DefaultTemplateKind = "BrowserItem.Disk")]
        public DataTemplate BrowserItemDiskDataTemplate
        {
            get
            {
                return _browserItemDiskDataTemplate;
            }
        } 
    }
}